<script setup>
defineProps({
  title: String,
  value: Number,
  icon: String,
  color: String,
});
</script>

<template>
  <div class="stat-card">
    <div class="stat-icon" :style="{ background: color }">
      {{ icon }}
    </div>
    <div class="content">
      <h3>{{ value }}</h3>
      <p>{{ title }}</p>
      <button class="detail-btn" :style="{ background: color }">
        查看数据详情
      </button>
    </div>
  </div>
</template>

<style scoped>
.stat-card {
  background: var(--bg-primary);
  padding: 1.2rem 1.5rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-height: 180px;
  justify-content: space-between;
  box-shadow: var(--card-shadow);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  flex: 1;
}

.content h3 {
  font-size: 2.2rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1rem;
}

.detail-btn {
  margin-top: auto;
  width: 100%;
  padding: 0.6rem 0;
  text-align: center;
  border: none;
  border-radius: 20px;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.detail-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-btn:active {
  transform: translateY(0);
  opacity: 1;
}
</style>
